home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!lorelei.demon.co.uk
- From: John Croudy <john@lorelei.demon.co.uk>
- Newsgroups: comp.lang.c++
- Subject: Re: goto command
- Date: Wed, 10 Apr 96 19:58:43 GMT
- Organization: home
- Message-ID: <9604101958.AA001q4@lorelei.demon.co.uk>
- References: <4k9vne$9lu@nntp.igs.net><4k9vne$9lu@nntp.igs.net> <9604081700.AA001p0@lorelei.demon.co.uk> <4kfuuh$3v8@nic.dataphone.se>
- X-NNTP-Posting-Host: lorelei.demon.co.uk
- X-Newsreader: TIN [AMIGA 1.3 950726BETA PL0]
- X-Mail2News-Path: disperse.demon.co.uk!post.demon.co.uk!lorelei.demon.co.uk
-
- On 10 Apr 1996 09:27:45 GMT, Jarmo Paavilainen wrote:
-
- > Why ?! goto is great for jumping out of loops !
- >
- > REDO:
- > for(i = 0;i<20;i++)
- > {
- > ...Do something
- > while(x != 3)
- > {
- > ...Do something
- > while(y ==4)
- > {
- > ...Do something
- >
- > if(t == 8)
- > goto DONE;
- >
- > if(t == 9)
- > goto REDO;
-
- It may be legal syntax but this is unstructured, difficult to follow,
- and makes a program hard to modify. I haven't used goto in any C or C++
- programs that I've written for 1.5 years, therefore I believe it is not
- needed. There's always a better way, although maybe not as FAST. In
- fact, the only reason to use it is for very fast forward jumps out of
- deep loops... but who needs that kind of micro-optimisation these days
- anyway? Better to waste a few microseconds at run time than spend days
- trying to untangle spagetti.
-
- John
- xxxx
-